package com.zxy.ziems.server.device.pojo.enums;

import com.zxy.ziems.server.alarm.enums.AlarmModeEnum;

import java.util.*;

/**
 * @Copyright (C),
 * @ClassName: AlarmTreeFilterEnum
 * @Author: yanzhiwei
 * @Description:
 * @Date: 2024/5/30 10:10
 */
public enum AlarmTreeFilterEnum {
    PAGE("page", "首页楼栋"),
    PAGE_LOGO("page-logo", "首页楼层图片"),
    OTHER("other", "其他"),
    ;

    private final String code;
    private final String info;

    AlarmTreeFilterEnum(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }

    public static AlarmTreeFilterEnum getByCode(Integer code) {
        for (AlarmTreeFilterEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static List<String> codeList() {
        return Arrays.asList(AlarmTreeFilterEnum.values()).stream()
                .map(AlarmTreeFilterEnum::getCode)
                .toList();
    }

    public static void main(String[] args) {
        List<Map<String, String>> list = new ArrayList<>();

        for (AlarmModeEnum value : AlarmModeEnum.values()) {
            Map<String, String> map = new HashMap<>();
            map.put(value.getCode(), value.getInfo());
            list.add(map);
        }


    }

}
